Optimal. Leaf size=124 \[ \frac {B x}{a^2}-\frac {2 \left (2 a^2 b B-b^3 B-a^3 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 124, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4157, 4008,
4004, 3916, 2738, 214} \begin {gather*} \frac {b (b B-a C) \tan (c+d x)}{a d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac {B x}{a^2}-\frac {2 \left (a^3 (-C)+2 a^2 b B-b^3 B\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d (a-b)^{3/2} (a+b)^{3/2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 4004
Rule 4008
Rule 4157
Rubi steps
\begin {align*} \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx &=\int \frac {B+C \sec (c+d x)}{(a+b \sec (c+d x))^2} \, dx\\ &=\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\int \frac {-\left (a^2-b^2\right ) B+a (b B-a C) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a \left (a^2-b^2\right )}\\ &=\frac {B x}{a^2}+\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\left (2 a^2 b B-b^3 B-a^3 C\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )}\\ &=\frac {B x}{a^2}+\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\left (2 a^2 b B-b^3 B-a^3 C\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^2 b \left (a^2-b^2\right )}\\ &=\frac {B x}{a^2}+\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\left (2 \left (2 a^2 b B-b^3 B-a^3 C\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 b \left (a^2-b^2\right ) d}\\ &=\frac {B x}{a^2}-\frac {2 \left (2 a^2 b B-b^3 B-a^3 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {b (b B-a C) \tan (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.60, size = 119, normalized size = 0.96 \begin {gather*} \frac {B (c+d x)-\frac {2 \left (-2 a^2 b B+b^3 B+a^3 C\right ) \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac {a b (b B-a C) \sin (c+d x)}{(a-b) (a+b) (b+a \cos (c+d x))}}{a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.19, size = 168, normalized size = 1.35
method | result | size |
derivativedivides | \(\frac {\frac {2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}+\frac {-\frac {2 a b \left (b B -a C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b \right )}-\frac {2 \left (2 a^{2} b B -b^{3} B -a^{3} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{a^{2}}}{d}\) | \(168\) |
default | \(\frac {\frac {2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}+\frac {-\frac {2 a b \left (b B -a C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b \right )}-\frac {2 \left (2 a^{2} b B -b^{3} B -a^{3} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{a^{2}}}{d}\) | \(168\) |
risch | \(\frac {B x}{a^{2}}-\frac {2 i b \left (-b B +a C \right ) \left (b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{a^{2} \left (a^{2}-b^{2}\right ) d \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) b B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) b^{3} B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) b^{3} B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}\) | \(577\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 250 vs.
\(2 (114) = 228\).
time = 2.60, size = 561, normalized size = 4.52 \begin {gather*} \left [\frac {2 \, {\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} d x \cos \left (d x + c\right ) + 2 \, {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5}\right )} d x - {\left (C a^{3} b - 2 \, B a^{2} b^{2} + B b^{4} + {\left (C a^{4} - 2 \, B a^{3} b + B a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - 2 \, {\left (C a^{4} b - B a^{3} b^{2} - C a^{2} b^{3} + B a b^{4}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{7} - 2 \, a^{5} b^{2} + a^{3} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} d\right )}}, \frac {{\left (B a^{5} - 2 \, B a^{3} b^{2} + B a b^{4}\right )} d x \cos \left (d x + c\right ) + {\left (B a^{4} b - 2 \, B a^{2} b^{3} + B b^{5}\right )} d x + {\left (C a^{3} b - 2 \, B a^{2} b^{2} + B b^{4} + {\left (C a^{4} - 2 \, B a^{3} b + B a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (C a^{4} b - B a^{3} b^{2} - C a^{2} b^{3} + B a b^{4}\right )} \sin \left (d x + c\right )}{{\left (a^{7} - 2 \, a^{5} b^{2} + a^{3} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (B + C \sec {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 201, normalized size = 1.62 \begin {gather*} \frac {\frac {2 \, {\left (C a^{3} - 2 \, B a^{2} b + B b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{4} - a^{2} b^{2}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {{\left (d x + c\right )} B}{a^{2}} + \frac {2 \, {\left (C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a^{3} - a b^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.09, size = 2500, normalized size = 20.16 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________